home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr44 / xlib06p1.zip / XPOINT.CPP < prev    next >
C/C++ Source or Header  |  1995-03-15  |  1KB  |  45 lines

  1. #include "xinternl.h"
  2. #include <conio.h>
  3. /*==================================================================
  4. XPOINT.CPP contains the basic functions for pixel manipulation in
  5. mode X.
  6.  
  7. These routines were written initially by Themie Gouthas and
  8. company and modified March 1995 by Victor B. Putz.
  9. ===================================================================*/
  10.  
  11.  
  12. extern int ScrnLogicalByteWidth;
  13. extern unsigned char * pbVGABuffer;
  14.  
  15. /*
  16. @func Puts a pixel to the screen at the appropriate
  17. offset, x, y location.
  18. */
  19. void x_put_pix(
  20.   xScreenCoord_t wX,
  21.   xScreenCoord_t wY,
  22.   xPageHandle_t wPageBase,
  23.   xColor_t wColor
  24. )
  25. {
  26.   int iOffset = ScrnLogicalByteWidth * wY + (wX / 4) + wPageBase;
  27.   outpw( SC_INDEX,  ( 0x0100 << ( wX & 3 ) ) + MAP_MASK );
  28.   pbVGABuffer[ iOffset ] = ( BYTE )wColor;
  29. }
  30.  
  31. /*
  32. @func Gets a pixel's color from the screen at the given offset, x,
  33. y location.
  34. */
  35. xColor_t x_get_pix(
  36.   xScreenCoord_t wX,
  37.   xScreenCoord_t wY,
  38.   xPageHandle_t wPageBase
  39. )
  40. {
  41.   int iOffset = ScrnLogicalByteWidth * wY + (wX / 4) + wPageBase;
  42.   outpw( GC_INDEX, ( (wX & 3) << 8 ) + READ_MAP );
  43.   return pbVGABuffer[ iOffset ];
  44. }
  45.